<?php 

require "../gobal.php";

$basepath=getBasePath();

$customer=currCustomer();
$sql="select * from order_sum_detail where  customer_id=".$customer["id"]." and oper_state!='cancel'  order by created_at desc";

$order_sums=fetch_rows($sql);


?>

<div class="navbar">
  <div class="navbar-inner">
    <div class="left sliding"><a href="/" class="link back icon-only"><i class="icon icon-back"></i></a></div>
    <div class="center sliding">完成订单</div>
    <div class="right"><a href="javascript:mainView.router.refreshPage()" class="link icon-only"><i class="icon icon-refresh"></i></a></div>
  </div>
</div>
<div class="pages navbar-through">
  <div data-page="user-orderlist-page" class="page">
    <div class="page-content">



        <div class="user-order-list">

			            <?php 

                         foreach($order_sums as $order_sum){
						$device_colorName=getColorName($order_sum["device_color"]);
                        $seviceName=getServiceName($order_sum["service_method"]);	 
                        $url="customer/order-checkpayment.php?oid=".$order_sum["id"];
                        $pay_stats=$order_sum["pay_stats"];
                        
                        
                        $pay_stats_text="正在处理";
                        $pay_fee=$order_sum["total_price"];
                        $pay_link="<a href='$url'  class='button button-gray'>付款</a>";
                        
                        if($pay_stats=="SUCCESS"){
                            $pay_stats_text="支付成功";
                            $pay_link="";
                            $pay_fee=$order_sum["pay_total_fee"]/100;
                        }
                        
                        
                        echo "<div class='user-order-item'>";
                        echo  "<div class='head'>订单号：<span class='color-blue'>".$order_sum["code"]."</span> <span class='order-status done'>$pay_stats_text</span></div>";
                        echo   "<div class='text'>";
                        echo   "<p>下单时间：<span class='color-black'>".$order_sum["created_at"]."</span></p>";
                        echo   "<p>订单类型：<span class='color-black'>".getOrderTypeName($order_sum["order_type"])."</span></p>";
                        echo   "<p>设备机型：<span class='color-black'>".$order_sum["device_name"]." $device_colorName</span></p>";
                        echo   "<p>服務明細：<span class='color-black'>".$order_sum["remark"]." </span></p>";
                        echo   "<p>服务类型：<span class='color-black'>$seviceName</span></p>";

					    echo   "<div class='total-price'>$pay_fee</div>";
                        echo   "$pay_link";

                        echo    "</div></div>";
					   }
                       ?>

                  <!-- 
<p>上门时间：<span class="color-black">今天  随时</span></p>
                                    <p>维修人员：<span class="color-black">未指派</span></p>

echo "<p>订单号:".$order_sum["code"]."</p>";
               echo "<p>下单时间：".$order_sum["created_at"]."</p>";
               echo "<p>设备机型：".$order_sum["device_name"]." $device_colorName</p>";
               echo "<p>手机故障:".$order_sum["remark"]."</p>";
               echo "<p>预估金额：".$order_sum["total_price"]."</p>";
               echo "<p>服务类型：$seviceName</p>";
                   -->


        </div>

      

    </div>
  </div>
</div>
